package test;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class UserServiceImplTest2 implements  InitializingBean, ApplicationContextAware{
    private ApplicationContext context;
    private int id;

    public void init(){
        System.out.println("自己写的init方法");
    }

    public void setId(int id){
        this.id=id;
        System.out.println(this.id);
    }



    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
       this.context=applicationContext;
        System.out.println("setapplicationContext---");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("通过接口来实例化的方法");
    }
}
